package com.changfeng.trade.service.impl;



import com.changfeng.trade.dao.JpaBaseDao;
import com.changfeng.trade.service.JpaBaseService;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;

import java.util.List;
import java.util.Optional;


/**
 * @Author: changfengchen
 * @Date: 2024/10/20 21:07
 * @Description:
 */
public abstract class JpaBaseServiceImpl<T,ID> implements JpaBaseService<T,ID> {

    protected abstract JpaBaseDao<T,ID> getJpaBaseDao();

    @Override
    public List<T> findAll() {
        return getJpaBaseDao().findAll();
    }

    @Override
    public List<T> findAll(Sort var1) {
        return getJpaBaseDao().findAll(var1);
    }

    @Override
    public List<T> findAllById(Iterable<ID> var1) {
        return getJpaBaseDao().findAllById(var1);
    }

    @Override
    public <S extends T> List<S> saveAll(Iterable<S> var1) {
        return getJpaBaseDao().saveAll(var1);
    }

    @Override
    public void flush() {
        getJpaBaseDao().flush();
    }

    @Override
    public <S extends T> S saveAndFlush(S var1) {
        return getJpaBaseDao().saveAndFlush(var1);
    }

    @Override
    public void deleteById(ID id) {
        getJpaBaseDao().deleteById(id);
    }

    @Override
    public void delete(T entity) {
        getJpaBaseDao().delete(entity);
    }

    @Override
    public void deleteAll(Iterable<? extends T> entities) {
        getJpaBaseDao().deleteAll(entities);
    }


    @Override
    public T getOne(ID var1) {
        return getJpaBaseDao().getOne(var1);
    }

    @Override
    public <S extends T> List<S> findAll(Example<S> var1) {
        return null;
    }

    @Override
    public <S extends T> List<S> findAll(Example<S> var1, Sort var2) {
        return null;
    }

    @Override
    public Optional<T> findOne(Specification<T> var1) {
        return Optional.empty();
    }

    @Override
    public List<T> findAll(Specification<T> var1) {
        return null;
    }

    @Override
    public Page<T> findAll(Specification<T> var1, Pageable var2) {
        return null;
    }

    @Override
    public List<T> findAll(Specification<T> var1, Sort var2) {
        return null;
    }

    @Override
    public long count(Specification<T> var1) {
        return 0;
    }
}

